package net.gxnun.xiaoyuan.core.message.handler.impl;

import net.gxnun.xiaoyuan.core.annotaction.MessageMapping;
import net.gxnun.xiaoyuan.core.message.handler.MessageHandler;
import net.gxnun.xiaoyuan.core.message.request.RequestMsg;
import net.gxnun.xiaoyuan.core.message.response.ResponseModel;
import net.gxnun.xiaoyuan.core.message.response.ResponseTextMsg;
import net.gxnun.xiaoyuan.core.share.MsgType;

import org.springframework.stereotype.Component;

@MessageMapping(value="default",msgType={MsgType.Image,MsgType.Link,MsgType.Location,MsgType.Text,MsgType.Voice})
@Component
public class DefaultMessageHandler implements MessageHandler{

    @Override
    public ResponseModel handler(RequestMsg msg) {
        ResponseTextMsg rMsg = new ResponseTextMsg();
        rMsg.setContent("非常高兴!");
        
        rMsg.setCreateTime(System.currentTimeMillis()+"");
        rMsg.setFromUserName(msg.getToUserName());
        rMsg.setToUserName(msg.getFromUserName());
        rMsg.setFuncFlag("");
        rMsg.setMsgType(MsgType.Text);
        
        ResponseModel model = new ResponseModel();
        model.setValue(rMsg);
        return model;
    }

}
